<?php
require_once(dirname(__FILE__)."/../libs/login/login.php");
require_once(dirname(__FILE__)."/../libs/string/libstr.php");
$mc=new libstr();
$lg=new login();
//echo $_SESSION["admin_member"]["userid"];
$dd=$lg->getsession("admin_member","rootid");
$usinfo=$lg->getuserinfo($_SESSION["admin_member"]["userno"]);
//print_r($usinfo);

?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>欢迎使用管理后台</title>
<style type="text/css">
<!--
body {
	font-family:'微软雅黑';
	font-size:13px;
}
.button-style{
	height:24px; 
	line-height:24px;
	 padding:0 10px; 
	 cursor:pointer; 
	 font-size:12px;
 }
.STYLE1{
		font-size:14px;
		font-family:'微软雅黑';
} 	
-->
</style>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {

	$("#login").click(function(){
	var userid=$("#userid").val();
	var password=$("#password").val();
	var code=$("#code").val();
	admin_login(userid,password,code);
		//alert("325df");
	})
})

function admin_login(userid,password,code){
	if(userid==""){
		alert("账号不能为空！");
		  return;
		}
			if(password==""){
		alert("密码不能为空！");
		  return;
		}
	if(code==""){
		alert("验证码不能为空！");
		  return;
		}
	$.ajax({ 
        type: "POST", 
        url: "ajax/login_inc.php", 
        dataType: "text", 
        data: {"logbtn":true,"userid":userid,"password":password,"code":code}, 
        beforeSend: function(){ 
      //僵直
        }, 
 success: function(data){
// alert(data);
 if(data.indexOf("code is wrong")!=-1){
  alert("验证码错误！");
	  return;	
 }else if(data.indexOf("userid is wrong")!=-1){
	 alert("账号错误！");
	  return;
 }else if(data.indexOf("password is wrong")!=-1){
	 alert("密码错误！");
	  return;
 } else if(data.indexOf("login is ok")!=-1){
	// alert("登录成功！");
	 location.href="/admin/index.php";
	  return;
 }else if(data.indexOf("have no power")!=-1){
 	 alert("您没有权限登录后台！");
	  return;
 }else{
 alert("登录失败！");
	  return;	
 }
 }
		 })
}
</script>
</head>

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td width="280" height="69" background="images/title_bg.gif">logo pic</td>
    <td align="right" valign="top" background="images/title_bg.gif">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2" bgcolor="#999999"><img src="images/dot_grey.gif" width="1" height="1"></td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="252"><img src="images/login_pic.jpg" width="252" height="216"></td>
    <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="45%" height="25" bgcolor="#F3F3F3">&nbsp; <img src="images/login_icon.gif" width="5" height="13" align="absmiddle">&nbsp;  <span class="STYLE1">LOGIN PAGE</span></td>
        <td width="55%" align="right" bgcolor="#F3F3F3"></td>
      </tr>
      <tr>
        <td colspan="2" bgcolor="#cccccc"><img src="images/dot_grey2.gif" width="1" height="1"></td>
      </tr>
    </table>
      <table width="650" border="0" cellpadding="0" cellspacing="0">
				<form name="form3" method="post" action="index.php">
                 <tr>
                    <td height="30" align="right">&nbsp;</td>
                    <td>&nbsp;</td>
                  </tr>
                  <tr>
                    <td height="30" align="right">账号:</td>
                    <td>&nbsp;
                      <input name="userid" type="text" id="userid" /></td>
                  </tr>
                  <tr>
                    <td height="30" align="right">密码:</td>
                    <td height="30">&nbsp;
                        <input name="password" type="password" id="password"/></td>
                  </tr>
                  <tr>
                    <td height="30" align="right">验证码:</td>
                    <td height="30">&nbsp;
						<input name="code" type="text" id="code" style="width:50px"/>
						<img src="../../libs/code/code.php?w=60&amp;h=22" alt="看不清楚？点击刷新验证码" style="cursor: pointer; border:1px #C66 solid; vertical-align:middle" onClick="javascript:this.src='../../libs/code/code.php?w=60&amp;h=22&amp;id=' + Math.random();" width="58px" height="21px" align="middle" />
                    </td>
                  </tr>
                  
                  <tr>
                    <td height="30">&nbsp;</td>
                    <td height="30">&nbsp;
                      <input name="login" type="button" value="登录" id="login"  class="button-style" >
                      
                  </tr>
			  </form>
              </table></td>
  </tr>
</table>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
      <tr>
        <td colspan="2" background="images/dot_blue.gif"><img src="images/dot_blue.gif" width="1" height="1" /></td>
      </tr>
      <tr>
        <td width="252" bgcolor="#EEEEEE">&nbsp;</td>
        <td height="20" bgcolor="#EEEEEE"><span style="color:#333; font-family:'微软雅黑'; font-size:12px;">Copyright &copy;<?php echo date('Y')?>,<a href="http://www.gdwangluo.com" target="_blank" style="text-decoration:none; color:#333">SPIDERTEC(网罗设计)</a>. All Rights Reserved.</span></td>
      </tr>
      <tr>
        <td height="10" colspan="2"></td>
      </tr>
    </table>
</body>
</html>